From a5d1bc41ecb847f95ece2059d3ca0842f76076a1 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 2 May 2001 21:31:52 +0000 Subject: [PATCH] Always trap errors around calls to XSetInputFocus since we have no way of Wed May 2 17:26:22 2001 Owen Taylor * gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always trap errors around calls to XSetInputFocus since we have no way of knowing reliably whether we are viewable or not. (#53947) --- ChangeLog | 7 +++++++ ChangeLog.pre-2-0 | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ gdk/x11/gdkevents-x11.c | 12 ++++++++++-- gdk/x11/gdkwindow-x11.c | 7 +++++++ 9 files changed, 66 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d14700783..d6a044fc0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed May 2 17:26:22 2001 Owen Taylor + + * gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always + trap errors around calls to XSetInputFocus since we have + no way of knowing reliably whether we are viewable or + not. (#53947) + Tue May 1 09:21:23 2001 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_button_release_drag_column): diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 5d14700783..d6a044fc0d 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +Wed May 2 17:26:22 2001 Owen Taylor + + * gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always + trap errors around calls to XSetInputFocus since we have + no way of knowing reliably whether we are viewable or + not. (#53947) + Tue May 1 09:21:23 2001 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_button_release_drag_column): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 5d14700783..d6a044fc0d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Wed May 2 17:26:22 2001 Owen Taylor + + * gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always + trap errors around calls to XSetInputFocus since we have + no way of knowing reliably whether we are viewable or + not. (#53947) + Tue May 1 09:21:23 2001 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_button_release_drag_column): diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 5d14700783..d6a044fc0d 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Wed May 2 17:26:22 2001 Owen Taylor + + * gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always + trap errors around calls to XSetInputFocus since we have + no way of knowing reliably whether we are viewable or + not. (#53947) + Tue May 1 09:21:23 2001 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_button_release_drag_column): diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 5d14700783..d6a044fc0d 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Wed May 2 17:26:22 2001 Owen Taylor + + * gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always + trap errors around calls to XSetInputFocus since we have + no way of knowing reliably whether we are viewable or + not. (#53947) + Tue May 1 09:21:23 2001 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_button_release_drag_column): diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 5d14700783..d6a044fc0d 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Wed May 2 17:26:22 2001 Owen Taylor + + * gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always + trap errors around calls to XSetInputFocus since we have + no way of knowing reliably whether we are viewable or + not. (#53947) + Tue May 1 09:21:23 2001 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_button_release_drag_column): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 5d14700783..d6a044fc0d 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Wed May 2 17:26:22 2001 Owen Taylor + + * gdk/x11/gdkevents-x11.c gdk/x11/gdkwindow-x11.c: Always + trap errors around calls to XSetInputFocus since we have + no way of knowing reliably whether we are viewable or + not. (#53947) + Tue May 1 09:21:23 2001 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_button_release_drag_column): diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index 8fdb559f00..2655d4278f 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -1487,8 +1487,16 @@ gdk_wm_protocols_filter (GdkXEvent *xev, GdkWindow *win = event->any.window; Window focus_win = GDK_WINDOW_IMPL_X11(((GdkWindowObject *)win)->impl)->focus_window; - XSetInputFocus (GDK_WINDOW_XDISPLAY (win), focus_win, - RevertToParent, xevent->xclient.data.l[1]); + /* There is no way of knowing reliably whether we are viewable so we need + * to trap errors so we don't cause a BadMatch. + */ + gdk_error_trap_push (); + XSetInputFocus (GDK_WINDOW_XDISPLAY (win), + focus_win, + RevertToParent, + xevent->xclient.data.l[1]); + XSync (GDK_WINDOW_XDISPLAY (win), False); + gdk_error_trap_pop (); } else if ((Atom) xevent->xclient.data.l[0] == gdk_atom_intern ("_NET_WM_PING", FALSE)) { diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 32aea75cc0..9cb966b065 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -1120,10 +1120,17 @@ gdk_window_focus (GdkWindow *window, else { XRaiseWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window)); + + /* There is no way of knowing reliably whether we are viewable so we need + * to trap errors so we don't cause a BadMatch. + */ + gdk_error_trap_push (); XSetInputFocus (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XWINDOW (window), RevertToNone, timestamp); + XSync (GDK_WINDOW_XDISPLAY (window), False); + gdk_error_trap_pop (); } } -- 2.30.2